package com.azure.bigstore.service;

import com.azure.bigstore.entity.Order;
import com.azure.bigstore.repository.OrderRepoditory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by liuhuaibin on 2018/1/23.
 */
@Service
public class OrderService {
    @Autowired
    private OrderRepoditory orderRepoditory;

    public List<Order> getOrderList(Long uid){
        return orderRepoditory.findByUid(uid);
    }

    public Order getOrder(String id){
        return  orderRepoditory.findOne(Long.valueOf(id));
    }

    public Order addOrder(Order order){
        return  orderRepoditory.save(order);
    }

    public void deleteOrder(String id){
        orderRepoditory.delete(Long.valueOf(id));
    }
}
